import Demo1.Solution2;

public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param A string字符串 
     * @return int整型
     */
    public int getLongestPalindrome (String A) {
        // write code here
        char[] chars = A.toCharArray();
        int left = 0, right = 0, ret = 0;
        while(right++ < chars.length) {
            int count = 0;
            int r = right, l = left;
            while(l <= r) {
                if(r >= 0 &&  r < chars.length && l < chars.length && chars[l] == chars[r]) {
                    if(l == r) {
                        count++;
                    }else {

                        count+= 2;
                    }
                    r--;
                    l++;
                }else {
                    count = 0;
                    r--;
                }
            }
            ret = Math.max(count,ret);
        }
        return ret;
    }
}
class Demo {
    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.getLongestPalindrome("abbba"));
    }
}